<template>
  <div class="formula-content">
   <prisms v-if="flag" :code="code" :type="type"> </prisms>
   <span class="description">{{ description }}</span>
  </div>
</template>

<script setup lang="ts">
import { ref, defineProps, watch, nextTick } from "vue";
import {decrypt, encrypt} from "@/util/rsa";

console.log(encrypt("123456器"));
let b = encrypt("123456器")

console.log(decrypt(b));
console.log(decrypt('Zankqx3IzKeTy+aNz7xBKZs1s5n+kipvCNjtF59pz9iRAKGBOisHblRqN89PsIVdsJlBR4xmUOgtWgUJWwaSKXAL2kuAiML1qo2El8q92Xa62UQRe1g/qWUNFb2LpcxVzrXEzyrIjE0rK/2DGVEP/1Q1RcAxsAfGfl34qmawbZI=\n'));
const props = defineProps({
  code: {
    type: String,
    default: `console.log('hello world);`,
  },
  type: {
    type: String,
    default: "js",
  },
  description: {
    type: String,
    default: "你好，世界！",
  },
});
let flag = ref(true);
watch(
    () => props.code,
    () => {
      flag.value = false;
      nextTick(() => {
        flag.value = true;
      });
    }
);
let value = JSON.stringify(submitData)
console.log(value.length)
let intercept = ""
let valueLength = value.length
let intercept1s = 0
let interceptLs = 100
let sub = {} as any
let slices = ()=>{
  if (valueLength - interceptLs > 100){
    intercept = value.slice(intercept1s,interceptLs)
    sub[interceptLs] = intercept
    interceptLs += 100
    intercept1s += 100
    console.log(sub)
    slices()
  }else {
    console.log(intercept)
    intercept = value.slice(interceptLs,valueLength)
    sub.last = intercept
  }
}
console.log(value.slice(0, 100));
console.log(value.slice(100, 200));
console.log(value.slice(200, 300));
console.log(value.slice(300, 400));
console.log(value.slice(400, value.length));

slices()
let a = value.slice(0, 100) +  value.slice(100, 200) +value.slice(200, 300) +value.slice(300, 400) +value.slice(400, value.length)
console.log(a)
XEUtils.objectEach(sub,(item:any)=>{
  a += decrypt(item)
})
</script>

<style lang="scss" scoped>
.formula-content {
  margin: 10px;
}
</style>
